package dao;

import java.sql.Connection;
import java.sql.SQLException;

public class GenericDao {

	protected Connection con;

	public GenericDao() {
		super();
		con = ConnectionUtil.getConnection();
	}

	public GenericDao(Connection con) {
		super();
		this.con = con;
	}

	public void close() throws DaoException {
		try {
			if (con != null || !con.isClosed()) {
				con.createStatement().execute("shutdown");
				con.close();
			}
		} catch (SQLException e) {
			throw new DaoException(e);
		}
	}
}